<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'loginimg.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  <script type="text/javascript" src="./js/jquery-1.8.2.js"></script></head>
  
  <body>
    	 <p>登陆界面图片:
     <div >
     <c:if test="${img==''}">
    	<form action="${pageContext.request.contextPath }/Guan/GuanLiUrl_insertLoginImg.action" method="post"
    	 enctype="multipart/form-data" onsubmit="return formSub1()">
		  	<input type="file"  name="file" style="margin-left: 30px;border: solid 1px #8fbc8f;" id="tfile"/>
		  	<input type="submit" value="添 加" style="padding-left: 25px;padding-right: 25px;">	  	
		  </form>
    </c:if>
     <c:if test="${img!='' }">
   		 <img alt="登陆界面图片" title="点击操作" src="/wifiIMG/img/loginImg/loginImg/${img}" height="80%" width="75%"><p><p>
    	<form action="${pageContext.request.contextPath }/Guan/GuanLiUrl_updateLoginImg.action" method="post"
    	 enctype="multipart/form-data" onsubmit="return formSub2()">
		  	<input type="file"  name="file" style="margin-left: 30px;border: solid 1px #8fbc8f;" id="xfile"/>
		  	<input type ="hidden" name="u.pic" value="${img }" id="pic">
		  	<input type="submit" value="保   存" style="padding-left: 25px;padding-right: 25px;">	  	
		  	<input type="button" value="删除" title="点击删除" onclick="shanchu()"/>
		  	</form>
		</c:if>
     </div>
  </body>
  <script type="text/javascript">
  	function shanchu(){
 		 var r=confirm("确定删除吗");
	  if (r==true){
	  	var pic = $("#pic").val();
		window.location.href=
		"${pageContext.request.contextPath }/Guan/GuanLiUrl_deleteLoginImg.action?&u.pic="+pic;
	   }
 	}
 	function tianjia(){
 			$("form").prop("action","${pageContext.request.contextPath }/Guan/GuanLiUrl_insertLoginImg.action");	
 	}
 	function formSub1(){
 		var t = $("#tfile").val();
 		if(t!=""){
 			return true;
 		}
 		alert("文件为空");
 		return false;
 	}
 	function formSub2(){
 		var x = $("#xfile").val();
 		
 		if(x!=""){
 			return true;
 		}
 		alert("文件为空");
 		return false;
 	}
  </script>
  
</html>
